﻿//===============================================================================
// Microsoft Innovation Centre - Western Europe
// Copyright (c) 2008 Microsoft Corporation. All rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//===============================================================================
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================

using System;

namespace Microsoft.WVB.Framework
{
    /// <summary>
    /// An Application exception thrown by Services classes.
    /// </summary>
    public class WVBServiceException : Exception
    {
        /// <summary>
        /// The reason why the Exception occured.
        /// </summary>
        public string Reason { get; set; }

        /// <summary>
        /// The Source class name responsible for having thrown the Exception.
        /// </summary>
        public string Source { get; set; }

        /// <summary>
        /// Initializes a <see cref="WVBServiceException"/>.
        /// </summary>
        public WVBServiceException():base() {}
    
        /// <summary>
        /// Initializes a <see cref="WVBServiceException"/>.
        /// </summary>
        /// <param name="message">A <see cref="String"/> which indicates the error message to display to a user.</param>
        /// <param name="reason">A <see cref="String"/> that indicates the reason why this exception occurred.</param>
        public WVBServiceException(string message, string reason)
            : base(message)
        {
            this.Reason = reason;
        }

        /// <summary>
        /// Initializes a <see cref="WVBServiceException"/>. 
        /// </summary>
        /// <param name="message">A <see cref="String"/> which indicates the error message to display to a user.</param>
        /// <param name="reason">A <see cref="String"/> that indicates the reason why this exception occurred.</param>
        /// <param name="source">A <see cref="String"/> that indicates the source (class or Control) which thrown the Exception.</param>
        public WVBServiceException(string message, string reason, string source)
            : this(message, reason)
        {
            this.Source = source;
        }

        /// <summary>
        /// Initializes a <see cref="WVBServiceException"/>. 
        /// </summary>
        /// <param name="message">A <see cref="String"/> which indicates the error message to display to a user.</param>
        /// <param name="innerException">A <see cref="Exception"/> based object describing the inner exception.</param>
        public WVBServiceException(string message, Exception innerException)
            : base(message, innerException){}
        
        /// <summary>
        /// Initializes a <see cref="WVBServiceException"/>. 
        /// </summary>
        /// <param name="message">A <see cref="String"/> which indicates the error message to display to a user.</param>
        /// <param name="reason">A <see cref="String"/> that indicates the reason why this exception occurred.</param>
        /// <param name="source">A <see cref="String"/> that indicates the source (class or Control) which thrown the Exception.</param>
        /// <param name="innerException">A <see cref="Exception"/> based object describing the inner exception.</param>
        public WVBServiceException(string message, string reason, string source, Exception innerException)
            : base(message, innerException)
        {
            this.Reason = reason;
            this.Source = source;
        }
    }
}
